<template>

  <div class="app-container">

   <!-- <div class="dashboard-editor-container" style="width: 80%;margin: 0 auto">-->
      <el-row>
        <el-col>
          <el-card class="box-card">
            <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="48px" style="margin-top: 10px">
              <el-form-item label="标题" prop="noticeTitle" >
                <el-input
                  v-model="queryParams.noticeTitle"
                  placeholder="请输入政策法规标题"
                  clearable
                  @keyup.enter.native="handleQuery"
                />
              </el-form-item>

              <el-form-item label="栏目" prop="contentColumn">
                <el-select
                  v-model="queryParams.contentColumn"
                  placeholder="请选择栏目"
                  clearable
                >
                  <el-option
                    v-for="dict in dict.type.zhengce"
                    :key="dict.value"
                    :label="dict.label"
                    :value="dict.value"
                  />
                </el-select>
              </el-form-item>
              <div style="text-align:right;">
              <el-form-item>
                <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
                <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
              </el-form-item>
              </div>
            </el-form>

            <el-table v-loading="loading" :data="contentList"  border @selection-change="handleSelectionChange">
              <el-table-column type="index" label="序号"   :index="indexMethod" align="center"/>
              <el-table-column label="政策法规" align="center" prop="noticeTitle">
                <template slot-scope="scope">
                  <div @click="getLista(scope.row)" v-hasPermi="['lys:policy:list']" style="cursor: pointer;">
                    {{scope.row.noticeTitle}}
                  </div>
                </template>

              </el-table-column>
              <el-table-column
                label="创建时间"
                prop="createTime"
                align="center"
                width="200px">
              </el-table-column>
            </el-table>


            <pagination
              v-show="total>0"
              :total="total"
              :page.sync="queryParams.pageNum"
              :limit.sync="queryParams.pageSize"
              @pagination="getList"
            />


          </el-card>
        </el-col>
      </el-row>
    </div>


  <!--</div>-->
</template>

<script>
  import {listContent, listtiao, listContentX} from "@/api/module/lys/policy/policy";
  import watermark from "watermark-dom";

  export default {
    name: "Content",
    dicts:['yh_notice_type','yh_notice_status','zhengce'],
    data() {
      return {
        // 遮罩层
        loading: true,
        // 选中数组
        ids: [],
        // 非单个禁用
        single: true,
        // 非多个禁用
        multiple: true,
        // 显示搜索条件
        showSearch: true,
        // 总条数
        total: 0,
        // 内容公告发布表格数据
        contentList: [],
        // 弹出层标题
        title: "",
        // 是否显示弹出层
        open: false,
        // 查询参数
        queryParams: {
          pageNum: 1,
          pageSize: 10,
          noticeType: '5',
          noticeTitle: null,
          noticeContent: null,
          noticeStatus: '1',
          pictureUrl: null,
          sourcesUrl: null,
          releaseTime: null,
          participants: null,
          viewsTimes: null,
          createBy: null,
          createTime: null,
          updateBy: null,
          updateTime: null,
          remark: null,
          note1: null,
          note2: null,
          note3: null,
          note4: null,
          note5: null,
          note6: null,
          note7: null,
          note8: null,
          note9: null,
          note10: null,
          orderByColumn:"createTime",
          isAsc:"desc"

        },
        // 表单参数
        form: {},
        // 表单校验
        rules: {}
      };
    },
    created() {
      this.getList();
    },
    mounted() {
      // 加载水印

      const username = this.$store.state.user.nickname;
      watermark.load({ watermark_txt: ' ' });



    },
    methods: {

      /** 查询内容公告发布列表 */
      getList() {
        this.loading = true;
        listContent(this.queryParams).then(response => {

          this.contentList = response.rows;

          this.total = response.total;
          this.loading = false;
        });
      },


      /** 详情操作 */
      getLista(row) {
        const id = row.id;
        // const tableName = row.tableName || this.tableNames[0];
        const params = {pageNum: this.queryParams.pageNum};

        this.$router.push({path: "/dangzheng/lyspolicyxiangqing", query: {id}});
      },
      handleQuery() {
        this.queryParams.pageNum = 1;
        this.getList();
      },
      /** 重置按钮操作 */
      resetQuery() {
        this.resetForm("queryForm");
        this.handleQuery();
      },

    },


  };
</script>
